<?php
apf_require_class("PageHelper");
$img_path = '/img/jximg/';
?>
    <div id="content">
        <div class="main">

            <!-- 提示框 BEGIN-->

            <div class="tips_d">
                <span class="dsp">&nbsp;</span>

                <div class="dd">
                    <i class="ddi">&nbsp;</i>d温馨提醒：你需要在2013年04月10日前做好2013年4-6月的计划&nbsp;&nbsp;<a class="blue" onclick="submitPlan('4-6')" href="javascript:void(0)">立即计划</a>
                </div>
                <div class="dd">
                    <i class="ddi">&nbsp;</i>主管提醒你，你的团队分数需微调
                </div>

            </div>

            <!-- 提示框 END-->

            <!-- 考评开始、、、 -->
            <div class="layer mbtm6">
                <h2>考评进程<span id="shownow"></span></h2>
                <div class="eav-process">
                    <div class="eav-process-t">
                         <ul class="prolist-t">
                              <li id="pro_w_0" class="pro_w_1">考评开始</li>
                              <li id="pro_w_1" class="pro_w_2">员工自评&amp;计划制定</li>
                              <li id="pro_w_2" class="pro_w_3 ">主管评分&amp;计划确定</li>
                              <li id="pro_w_3" class="pro_w_4">部门分数微调</li>
                              <li id="pro_w_4" class="pro_w_5">HR审批</li>
                              <li id="pro_w_5" class="pro_w_6">分数查看</li>
                         </ul>
                     </div>
                     <div class="eav-process-c">
                         <ul class="prolist-c">
                             <?php foreach($review_days as $k=>$val):?>
                             <?php $class= 'eav-round';
                                 if($val['class']=='pass'){
                                     $class = 'eav-round-through';
                                 }elseif($val['class']=='curr'){
                                     $class = 'eav-round-current';
                                 }
                             ?>

                             <?php if($k<=4):?>
                              <li class="pro-c-1"><span id="eav-txt_<?=$k?>" class="<?=$class?>"></span><span id="show_<?=$k?>" class="eav-line"></span>
                              <span id="flag" class="eav-flag" ></span>
                              </li>
                              <?php endif;?>
                              <?php endforeach;?>
                         </ul>
                     </div>
                     <div class="eav-process-b">
                         <ul class="prolist-b">
                         <?php if($review_days):?>
                         <?php foreach($review_days as $k=>$val):?>
                             <li class="pro_w_<?=$k?>" id="pro_<?=$k?>" <?php if($k==6):?>style="display:none"<?php endif;?>><?=date('Y-m-d',strtotime($val['step_date']))?></li>
                         <?php endforeach;?>
                         <?php else:?>
                         当前不是考评月
                         <?php endif;?>
                         </ul>
                     </div>
                 </div>
               </div>
            <div class="layer mbtm6">
                <h2>直属考评动态</h2>
                  <table border="0" cellpadding="0" cellspacing="0" class="table01">
                    <tbody>
                        <tr class="title">
                               <td width="175">姓名 </td>
                             <td width="188"><?=intval(substr($last_month[0],4,2))?>-<?=intval(substr($last_month[0],6,2))?>月的考评</td>
                             <td><?=intval(substr($last_month[1],4,2))?>-<?=intval(substr($last_month[1],6,2))?>月的计划</td>
                        </tr>
                        <?php foreach($sub_list as $k=> $user):?>
                            <tr name="team" >
                                <td style="vertical-align:middle"><?=$user['name']?></td>
                                <td>
                                <?php /*设置免考或上次没有做计划的*/?>
                                <?php if(!empty($no_kp[$user['user_id']]) || empty($team_list[$user['user_id']][$last_month[0]])):?>
                                免考
                                <?php else:?>
                                <?php $plan_A =$team_list[$user['user_id']][$last_month[0]]; ?>
                                <?php if($plan_A['status']==40):?>
                                <a href="<?=Util_JxUrls::plan_url('SuperScore',array('user_id'=>$user['user_id'],'searchDate'=>$last_month[0]))?>" class="blue">打分</a><img style="display:inline" src="<?=PageHelper::pure_static_url($img_path . "new.png");?>"/>
                                <?php elseif($plan_A['status']==45):?>
                                <a href="<?=Util_JxUrls::plan_url('view',array('user_id'=>$user['user_id'],'searchDate'=>$last_month[0]))?>" class="blue">微调</a>
                                <?php elseif($plan_A['status']==30):?>
                                需自评
                                <?php else:?>
                                <a href="<?=Util_JxUrls::plan_url('view',array('user_id'=>$user['user_id'],'searchDate'=>$last_month[0]))?>" class="blue">查看</a>
                                <?php endif;?>
                                <?php endif;?>
                                 </td>
                                 <td>
                                 <?php if(empty($team_list[$user['user_id']][$last_month[1]])):?>
                                  待创建计划
                                 <?php else:?>
                                 <?php $plan_B =$team_list[$user['user_id']][$last_month[1]]; ?>

                                 <?php if($plan_B['status']==20):?>
                                 <a href="<?=Util_JxUrls::plan_url('add',array('user_id'=>$user['user_id'],'searchDate'=>$last_month[1]))?>" class="blue">确认计划</a></span>
                                 <?php elseif($plan_B['status']==10 ||$plan_B['status']==15 ):?>
                                 <?=$plan_status[$plan_B['status']]?>
                                 <?php else:?>
                                 计划已审核
                                 <?php endif;?>
                                 <?php endif;?>
                                 </td>
                            </tr>
                        <?php endforeach;?>
                    </tbody>
                </table>
            </div>

            <div class="layer mbtm6">
                <h2>我的考评动态</h2>
                <table border="0" cellpadding="0" cellspacing="0" class="table01">
                    <tbody>
                         <tr>
                            <th width="96"><?=intval(substr($last_month[0],4,2))?>-<?=intval(substr($last_month[0],6,2))?>月自评：</th>
                            <td width="145">
                            <?php if(!empty($my_plan_list[$my_user_id][$last_month[0]])):?>
                            <?php $my_plan_A = $my_plan_list[$my_user_id][$last_month[0]];
                            $url = Util_JxUrls::plan_url('view',array('user_id'=>$my_user_id,'searchDate'=>$last_month[1]));
                            $title = '去查看';
                            ?>
                            <?php if($my_plan_A['status']==30):?>
                            <?php
                                $url = Util_JxUrls::plan_url('SelfScore',array('user_id'=>$my_user_id,'searchDate'=>$last_month[1]));
                                $title = '去自评';
                            ?>
                            <span class="red-icon">需自评</span>
                            <?php elseif($my_plan_A['status']==40):?>
                            <?php
                                $url = Util_JxUrls::plan_url('SelfScore',array('user_id'=>$my_user_id,'searchDate'=>$last_month[1]));
                                $title = '去修改';
                            ?>
                            <span class="green-icon">待主管审核</span>
                            <?php elseif($my_plan_A['status']==70):?>
                            <span class="green-icon">上级已确认，已完成</span>
                            <?php else:?>
                            <span class="green-icon">上级已打分</span>
                            <?php endif;?>
                            <?php endif;?>
                            </td>
                            <td>
                            <?php if(!empty($my_plan_list[$my_user_id][$last_month[0]])):?>
                            <a href="<?=$url?>" class="blue"><?=$title?>&gt;&gt;</a>
                            <?php endif;?>
                            </td>
                         </tr>
                        <tr>
                            <th width="96"><?=intval(substr($last_month[1],4,2))?>-<?=intval(substr($last_month[1],6,2))?>月计划：</th>
                            <?php if(!empty($my_plan_list[$my_user_id][$last_month[1]]['status']) && $my_plan_list[$my_user_id][$last_month[1]]['status']==20):?>
                            <td width="145"><span class="green-icon">上级已确认，已完成</span></td>
                            <td><a href="<?=Util_JxUrls::plan_url('add',array('user_id'=>$my_user_id,'searchDate'=>$last_month[1]))?>" class="blue">去查看&gt;&gt;</a></td>
                            <?php else:?>
                            <td width="145"><span class="red-icon">尚未计划</span></td>
                            <td><a href="<?=Util_JxUrls::plan_url('add',array('user_id'=>$my_user_id,'searchDate'=>$last_month[1]))?>" class="blue">去计划&gt;&gt;</a></td>
                            <?php endif;?>
                        </tr>
                    </tbody>
                </table>
            </div>

            <!-- 考评结束、、、 -->
            <div class="layer mbtm6">
                <h2>年度考评总览</h2>
                <div class="total-view clearfix">

                    <div class="total-boxer" id="saylist">
                    <ul style="margin-top:0px;">
                    <?php if(!empty($my_score_list)):?>
                    <?php foreach($my_score_list as $year=> $val):?>
                        <li>
                        <?php if(!empty($val['list'])):?>
                        <?php foreach($val['list'] as $month=> $value):?>
                        <dl>
                              <dt><?=intval(substr($month,4,2))?>-<?=intval(substr($month,6,2))?>月</dt>
                              <dd>
                              <?php echo $value==-1 ? '-': $value?>
                              </dd>
                           </dl>
                        <?php endforeach;?>
                        <dl>
                               <dt>年度得分</dt>
                               <dd>
                               <?php if(empty($val['all']['cnt'])):?>
                               -
                               <?php else:?>
                               <?php $last_score = $val['all']['score']/$val['all']['cnt'];
                               echo $last_score .'('. Const_JxStatus::check_score_stage($last_score).')';
                               ?>

                               <?php endif;?>
                               </dd>
                            </dl>
                        <?php endif;?>
                        </li>
                        <?php endforeach;?>
                        <?php endif;?>

                      </ul>

                    </div>

                    <span id="xt_down">下翻xxxxxx</span>
                    <span id="xt_up">上一年xxxxxx</span>

                </div>

            </div>

        </div>

        <!--  -->
        <div class="side">
            <div class="user-info layer mbtm6">
                <h2><?=$view_user_info['name']?></h2>
                <div class="content">
                    <ul>
                        <li><?=$view_user_info['department_name']?></li>
                        <li><?=$view_user_info['job_name']?></li>
                        <li>入职时间：<?=date('Y-m-d',strtotime($view_user_info['enter_date']))?></li>
                    </ul>
                    <ul>
                        <li>上级主管：<?=$view_user_info['superior']->name?></li>
                    </ul>
                </div>
            </div>

        </div>
    </div>


<form action="toAddPlan.action" id="toAddPlanIds">
  <input name="kaoPinMonth" id="kaoPinMonth_ids" type="hidden" />
</form>

<form action="toEditPlanInfo.action" id="toEditPlanIds">
  <input name="editKaoPinMonth" id="editKaoPinMonth_ids" type="hidden" />
</form>

<form action="queryPlanInfo.action" id="toQueryPlanInfo">
  <input name="kaoPinMonth" id="kaoPinMonth_plan_ids" type="hidden" />
  <input name="operatorType" id="operatorType_ids" type="hidden" />
  <input name="types" id="types_ids" type="hidden" />
</form>

</body>
<?php $this->script_block_begin(); ?>
<script type="text/javascript">
   $(function(){
       var myDate = new Date();

        //var day=myDate.getFullYear()+"-"+(myDate.getMonth()+1)+"-"+myDate.getDate(); //获取完整的年份(4位,1970-????)
        //$('#shownow').html("("+day+")");
        $('#top_1').addClass("tab-on");
        /*$('tr').each(function(i){
            if(i%2!=0){
                $(this).addClass("bluebg");
            }
        });*/
   });

  function submitPlan(planMonth)
  {
      $('#kaoPinMonth_ids').val(planMonth);
      $('#toAddPlanIds').submit();
  }

  function updatePlan(planMonth)
  {
      $('#editKaoPinMonth_ids').val(planMonth);
      $('#toEditPlanIds').submit();
  }

  function queryPlan(planMonth)
  {
      $('#kaoPinMonth_plan_ids').val(planMonth);
      $('#operatorType_ids').val(2);
      $('#toQueryPlanInfo').submit();
  }

  function showTimeBefore(){

        var myDate = new Date();

        var day=myDate.getFullYear()+"/"+(myDate.getMonth()+1)+"/"+myDate.getDate(); //获取完整的年份(4位,1970-????)


        for (var i=0;i<6;i++){

             if(new Date(day)<=new Date($("#pro_"+i).text().replace(/-/g,"/"))){

                 for(var j=0;j<i;j++){
                      $("#show_"+j).removeClass("eav-line");
                      $("#show_"+j).addClass("eav-line-through");
                      $("#eav-txt_"+j).removeClass("eav-round");
                      $("#eav-txt_"+j).addClass("eav-round-through");
                  }
                  leaveTime=new Date($("#pro_"+(i+1)).text().replace(/-/g,"/"))-new Date();

                  leaveDays=Math.floor(leaveTime/(1000*60*60*24));

                  leaveHours=Math.floor((leaveTime-leaveDays*(1000*60*60*24))/(1000*60*60));
                  leaveMinutes=Math.floor((leaveTime-leaveDays*(1000*60*60*24)-leaveHours*(1000*60*60))/(1000*60));
                  leaveSeconds=Math.floor((leaveTime-leaveDays*(1000*60*60*24)-leaveHours*(1000*60*60)-(leaveMinutes*1000*60))/1000);
            //	  var mess="本阶段"+leaveDays+"天"+leaveHours+"小时"+leaveMinutes+"分"+leaveSeconds+"秒";
                  var mess="本阶段"+leaveDays+"天"+leaveHours+"小时后截止";
                $("#pro_w_"+i).addClass("current");
                $("#eav-txt_"+i).removeClass("eav-round");
                $("#eav-txt_"+i).addClass("eav-round-current");
                //$("#show_"+i).html("<em class='eav-box-c'><p><span class='timer'></span>"+mess+"</p></em>");

                 break;

             }
        }
        if(new Date(day)<new Date($("#pro_"+5).text().replace(/-/g,"/"))){

             $("#flag").addClass("eav-flag-gray");
         }else{

             $("#flag").addClass("eav-flag");
         }
    }
    setInterval(showTimeBefore,1000);
    $(function(){

    	var _wrap=$('#saylist');//定义滚动区域
    	var s = $("li", _wrap).length;
		var w = $("li", _wrap).width();
		var h = $("li", _wrap).height();
		var ts = s-1;
		var t = 0;

		function animate(dir){
			var ot = t;
			switch(dir){
				case "next":t = (ot>=ts) ? ts : t+1; break;
				case "prev":t = (t<=0) ?  0 : t-1;break;
				case "first":t = 0;break;
				case "last":t = ts;break;
				case "current":break;
				default:break;
			};
		    if(t==0){speed=0;}
		    p = (t*h*-1);
		    $("ul",_wrap).animate({ marginTop: p }, 500);
		}

    	$('#xt_down').click(function(){
    		animate('next');
        });
    	$('#xt_up').click(function(){
    		animate('prev');
        });
    });
</script>
<?php $this->script_block_end(); ?>